package com.pt5.pthouduan.config;

import com.turn.ttorrent.tracker.TrackedTorrent;
import java.io.File;

public class TorrentInfoHashPrinter {
    public static void main(String[] args) throws Exception {
        File torrentFile = new File("D:\\torrenttest\\111111\\output.torrent");
        TrackedTorrent torrent = TrackedTorrent.load(torrentFile);
        byte[] infoHash = torrent.getInfoHash();

        // 打印十六进制形式的 info_hash
        System.out.println("info_hash (hex): " + bytesToHex(infoHash));
    }

    private static String bytesToHex(byte[] bytes) {
        StringBuilder sb = new StringBuilder();
        for (byte b : bytes) {
            sb.append(String.format("%02X", b));
        }
        return sb.toString();
    }
}

